/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}
body::before {
    content: '';
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 30%, rgba(52,152,219,0.18) 0, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(241,196,15,0.12) 0, transparent 50%),
                radial-gradient(circle at 60% 20%, rgba(46,204,113,0.10) 0, transparent 40%);
    animation: bgmove 12s linear infinite alternate;
}
@keyframes bgmove {
    0% { background-position: 20% 30%, 80% 70%, 60% 20%; }
    100% { background-position: 30% 40%, 70% 60%, 50% 30%; }
}

.container {
    max-width: 950px;
    margin: 30px auto;
    background: rgba(255,255,255,0.92);
    padding: 32px 32px 24px 32px;
    border-radius: 22px;
    box-shadow: 0 12px 48px 0 rgba(52, 152, 219, 0.22), 0 2px 8px rgba(44,62,80,0.10);
    position: relative;
    z-index: 1;
    border: 3px solid #6dd5fa;
}

header {
    text-align: center;
    margin-bottom: 36px;
}

header h1 {
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    color: #f1c40f;
    text-shadow: 0 4px 16px #2980b9, 0 1px 0 #fff;
    font-size: 2.8rem;
    letter-spacing: 3px;
    margin-bottom: 10px;
    font-weight: 900;
}

h2 {
    color: #e67e22;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.7rem;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    text-shadow: 0 2px 8px #fff, 0 1px 0 #2980b9;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    background: linear-gradient(90deg, #f7971e 0%, #ffd200 100%);
    color: #232526;
    padding: 13px 32px;
    margin: 6px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(241,196,15,0.18);
    transition: background 0.3s, transform 0.18s, box-shadow 0.18s;
    letter-spacing: 1px;
    border: 2px solid #f1c40f;
}

.btn:hover {
    background: linear-gradient(90deg, #ffd200 0%, #f7971e 100%);
    transform: translateY(-3px) scale(1.06) rotate(-1deg);
    box-shadow: 0 8px 32px rgba(241,196,15,0.22);
}

.btn.secondary {
    background: linear-gradient(90deg, #95a5a6 0%, #bdc3c7 100%);
    color: #fff;
    border: 2px solid #7f8c8d;
}

.btn.secondary:hover {
    background: linear-gradient(90deg, #7f8c8d 0%, #b2bec3 100%);
}

.difficulty-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

/* 游戏区域 */
.menu-section, #game-section, #leaderboard-section {
    text-align: center;
    padding: 24px 10px;
    position: relative;
    z-index: 1;
}

.hidden {
    display: none;
}

/* 拼图板样式 */
.puzzle-board {
    position: relative;
    margin: 0 auto;
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    border: 4px solid #f1c40f;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 8px 32px 0 #f1c40f44, 0 2px 12px #2980b944;
    animation: boardGlow 2.5s infinite alternate;
}
@keyframes boardGlow {
    0% { box-shadow: 0 8px 32px 0 #f1c40f44, 0 2px 12px #2980b944; }
    100% { box-shadow: 0 12px 48px 0 #f1c40f99, 0 4px 24px #2980b999; }
}

.puzzle-tile {
    position: absolute;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #6dd5fa 0%, #2980b9 100%);
    color: #fff;
    font-size: 36px;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(.4,2,.6,1);
    border-radius: 12px;
    box-shadow: 0 4px 16px #6dd5fa44, 0 2px 8px #2980b944;
    border: 2.5px solid #f1c40f;
    outline: 2.5px solid #fff8;
    filter: drop-shadow(0 0 8px #f1c40f88);
    animation: tilePulse 2.2s infinite alternate;
}
@keyframes tilePulse {
    0% { filter: drop-shadow(0 0 8px #f1c40f88); }
    100% { filter: drop-shadow(0 0 18px #f1c40faa); }
}
.puzzle-tile:hover {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    color: #232526;
    box-shadow: 0 8px 32px #f1c40f88, 0 4px 16px #2980b988;
    transform: scale(1.08) rotate(-2deg);
    z-index: 2;
    border-color: #fff;
}

/* 原图参考美化 */
#original-image {
    width: 300px;
    max-width: 100%;
    border: 3px solid #6dd5fa;
    border-radius: 14px;
    box-shadow: 0 4px 18px #6dd5fa33, 0 2px 8px #2980b933;
    margin-top: 8px;
    margin-bottom: 8px;
    background: #fff;
}

/* 游戏信息 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    background: linear-gradient(90deg, #232526 0%, #6dd5fa 100%);
    border-radius: 10px;
    padding: 14px 22px;
    box-shadow: 0 2px 8px #2980b933;
    border: 2px solid #f1c40f;
}

.game-info {
    font-size: 21px;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    font-weight: 700;
    color: #f1c40f;
    text-shadow: 0 2px 8px #2980b933;
}

.game-info span {
    margin-right: 22px;
}

/* 完成界面 */
#game-complete {
    margin-top: 24px;
    padding: 32px 18px 28px 18px;
    background: linear-gradient(120deg, #f1c40f 0%, #6dd5fa 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px #f1c40f33, 0 2px 8px #2980b933;
    border: 3px solid #fff;
    animation: winFlash 1.2s infinite alternate;
    position: relative;
}
@keyframes winFlash {
    0% { box-shadow: 0 8px 32px #f1c40f33, 0 2px 8px #2980b933; }
    100% { box-shadow: 0 16px 48px #f1c40f77, 0 4px 16px #2980b977; }
}
#game-complete h2 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 2rem;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
    text-shadow: 0 2px 8px #fff, 0 1px 0 #2980b9;
}
#game-complete p {
    font-size: 20px;
    margin: 10px 0;
    color: #232526;
    font-family: 'Press Start 2P', 'Segoe UI', 'Arial', sans-serif;
}

/* 响应式设计 */
@media (max-width: 1100px) {
    .container {
        max-width: 99vw;
        padding: 10px;
    }
    #original-image {
        width: 180px;
    }
}
@media (max-width: 800px) {
    .difficulty-buttons {
        flex-direction: column;
        gap: 10px;
    }
    #original-image {
        width: 120px;
    }
}
@media (max-width: 600px) {
    .puzzle-tile {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    #original-image {
        width: 80px;
    }
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(52,152,219,0.05);
    border-radius: 8px;
    overflow: hidden;
}
.leaderboard-table th, .leaderboard-table td {
    border: 1px solid #ddd;
    padding: 10px 8px;
    text-align: center;
    font-size: 16px;
}
.leaderboard-table th {
    background: linear-gradient(90deg, #3498db 0%, #6dd5fa 100%);
    color: #fff;
    font-size: 17px;
}
.leaderboard-table tr:nth-child(even) {
    background: #f2f6fa;
}

#leaderboard-chart {
    margin-bottom: 18px;
    border-radius: 8px;
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(52,152,219,0.05);
}